//----BEGIN LICENSE----//
/*****************************************************************\
** prevalentLite - sqlite3 persistence object library 
**
** Copyright (C) 2008 Philip R. Schuchardt
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program.  If not, see <http://www.gnu.org/licenses/>.
**
*****************************************************************/
//----END LICENSE----//

/*-------------------------------------------------------------------------------------------------
        plString is a database aware std::string.  It caches a double
	in memory.  When the double is assigned updates the database
	automatically.
	
	By: Philip Schuchardt - 2008-10-26
---------------------------------------------------------------------------------------------------*/

#ifndef plSTRING_H
#define plSTRING_H

//STD includes
#include <string>

//Our includes
#include "plData.h"

class plString : public plData {

	public:
	//Constructor
        plString();
	
	//Constructor
        plString(const char* value);
	
	//Constructor
        plString(const std::string& value);
	
	//Copy constructor
        plString(const plString& obj);
	
        virtual ~plString() { }

	//Accessor
        const std::string& Data();
	
	//Modifier
        void SetData(const std::string& value);
	
	//Operator overloading
        void operator=(const std::string& value);
	
	//Operator overloading
        void operator=(const plString& obj);
	
	//Operator overloading
	void operator=(const char* value);
	
	//Operator casting overloading
        operator const std::string&();
        operator std::string();
	
	//Binds the data with the statement
	virtual void Bind(sqlite3_stmt* statement, int index = 1) const;
	
	//Gets the data from the current statement
	virtual void Column(sqlite3_stmt* statement, int index = 0);
	
	//The classes name
        static const char* GetClassName() { return "plString"; }
	
	
private:

        void Copy(const plString& obj);

        std::string Value;
};



#endif //plSTRING_H

